home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 027a / seekfi.zip / SEEKFIX.PRG < prev    next >
Text File  |  1991-07-11  |  2KB  |  57 lines

  1.  
  2. /*
  3.  
  4.            COPYRIGHT (c) 1991 by Rodd Graham.  ALL RIGHTS RESERVED.
  5.  
  6.     Title: Seek bug workaround for Clipper 5.01
  7.    Author: Rodd Graham
  8.            Software Services
  9.            6803 W. 64th Street
  10.            Overland Park, Kansas 66202
  11.            913-384-2809
  12.      Date: July 11, 1991
  13.  
  14.     Usage: Compile with /M /N /L /W
  15.            Include SeekFix.CH in all OTHER Clipper 5.01 code
  16.            Link with SeekFix.OBJ
  17.  
  18.      Desc: Uses softseeking coupled with a final comparison between the
  19.            seek value and the index expression evaluation to overcome the
  20.            internal clipper error localized to the found() function and its
  21.            underlying variable.  When Nantucket fixes bug, remove inclusion
  22.            of SeekFix.CH; stop linking with SeekFix.OBJ
  23.  
  24. Recommendation: Develop a standard include file for YOUR company/person, and
  25.                 use a nested include reference to SeekFix.CH.  Then, you will
  26.                 only need to remove the include from a single file
  27.                 (YourSTD.CH) when the fix is made.  Further, companywide
  28.                 extensions to clipper can be made in this file.  (EXAMPLE:
  29.                 The default #xcommand below resides in our company include
  30.                 file)
  31.  
  32. */
  33.  
  34. #xcommand DEFAULT <x> TO <y> [TYPE <z>] => ;
  35.   <x> := iif(valtype(<x>)$(valtype(<y>)+upper(#<z>)),<x>,<y>)
  36.  
  37. static FoundFlags[250]
  38.  
  39. static function SetSoftSeek(Mode)
  40. return (iif(ValType(Mode)$"L",Set(_SET_SOFTSEEK,Mode),Set(_SET_SOFTSEEK)))
  41.  
  42. function FoundFix
  43. return (FoundFlags[Select()])
  44.  
  45. function DBSeekFix(Value,SoftSeekMode)
  46.   local WorkArea := select()
  47.  
  48.   default SoftSeekMode to SetSoftSeek()
  49.  
  50.   dbseek(Value,.t.)
  51.  
  52.   if !(FoundFlags[WorkArea] := (&(IndexKey(0)) = Value)) .and. !SoftSeekMode
  53.     goto 0
  54.   endif
  55.  
  56. return (FoundFlags[WorkArea])
  57.